<%-- 
    Document   : index
    Created on : Sep 8, 2013, 2:29:59 AM
    Author     : Administrator
--%>

<%@page import="Controler.CXuLy"%>
<%@page import="Model.Pojo.Nhanvien"%>
<%@page import="Model.Pojo.Loainhanvien"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<head>
    <meta charset="utf-8" />
    <%
        Nhanvien nv = (Nhanvien) request.getAttribute("Chitietnhanvien");
        if (nv != null)
        {%>
    <title>Cập nhật nhân viên</title>
    <%    }
    else
    {
    %>
    <title>Thêm nhân viên</title>
    <%}%>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
    <meta content="Mosaddek" name="author" />
    <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" />
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <link href="css/style-responsive.css" rel="stylesheet" />
    <link href="css/style-default.css" rel="stylesheet" id="style_color" />

    <link href="assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" />
    <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" />
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <link href="css/style-responsive.css" rel="stylesheet" />
    <link href="css/style-default.css" rel="stylesheet" id="style_color" />

    <link href="assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" />

    <link rel="stylesheet" type="text/css" href="assets/chosen-bootstrap/chosen/chosen.css" />
    <link rel="stylesheet" type="text/css" href="assets/jquery-tags-input/jquery.tagsinput.css" />
    <link rel="stylesheet" type="text/css" href="assets/clockface/css/clockface.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-timepicker/compiled/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" href="assets/bootstrap-toggle-buttons/static/stylesheets/bootstrap-toggle-buttons.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-daterangepicker/daterangepicker.css" />

</head>
<%
    List<Loainhanvien> dsLoaiNV = (List<Loainhanvien>) request.getAttribute("dsLoaiNV");
%>
<body class="fixed-top">
    <jsp:include page="User Control/banner.jsp" flush="true"></jsp:include>
        <div id="container" class="row-fluid">
        <jsp:include page="User Control/menu.jsp" flush="true"></jsp:include>
            <div id="main-content">
                <div class="container-fluid">
                <jsp:include page="User Control/title.jsp" flush="true"></jsp:include>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="widget box purple">
                                <div class="widget-title">
                                    <h4>
                                    <%if (nv != null)
                                        {%>
                                    <i class="icon-reorder"></i> Cập nhật nhân viên</span>
                                    <%}
                                    else
                                    {%>
                                    <i class="icon-reorder"></i> Thêm nhân viên</span>
                                    <%}%>
                                </h4>
                                <span class="tools">
                                    <a href="javascript:;" class="icon-chevron-down"></a>
                                    <a href="javascript:;" class="icon-remove"></a>
                                </span>
                            </div>
                            <div class="widget-body">
                                <%
                                     Object obj = request.getAttribute("QUAN_LY_NHAN_VIEN");
                                    if (obj != null)
                                    {
                                    if (nv != null)
                                    {
                                %>
                                <form method="post" class="form-horizontal" action="update-nhan-vien.htm">
                                    <div id="tabsleft" class="tabbable tabs-left">
                                        <ul>
                                            <li><a href="#tabsleft-tab1" data-toggle="tab"><span class="strong">Bước 1</span> <span class="muted">Chức vụ</span></a></li>
                                            <li><a href="#tabsleft-tab2" data-toggle="tab"><span class="strong">Bước 2</span> <span class="muted">Thông tin đăng nhập</span></a></a></li>
                                            <li><a href="#tabsleft-tab3" data-toggle="tab"><span class="strong">Bước 3</span> <span class="muted">Thông tin cá nhân</span></a></a></li>
                                        </ul>
                                        <div class="progress progress-info progress-striped">
                                            <div class="bar"></div>
                                        </div>
                                        <div class="tab-content">
                                            <div class="tab-pane" id="tabsleft-tab1">
                                                <h3>Chọn chức vụ</h3>
                                                <div class="control-group">
                                                    <label class="control-label">Chức vụ</label>
                                                    <div class="controls">
                                                        <select name="ddlLoaiNV" class="span6 chzn-select" data-placeholder="Chọn ..." tabindex="1" required>
                                                            <%
                                                                for (Loainhanvien loaiNV : dsLoaiNV)
                                                                {
                                                                    if (loaiNV.getId() == nv.
                                                                            getLoainhanvien().
                                                                            getId())
                                                                    {
                                                            %>
                                                            <option selected="true" value="<%=loaiNV.getId()%>"><%=loaiNV.getTenloai()%></option>
                                                            <%}
                                                            else
                                                            {%>
                                                            <option value="<%=loaiNV.getId()%>"><%=loaiNV.getTenloai()%></option>
                                                            <%}
                                                                }%>
                                                        </select>
                                                    </div>
                                                    <br/><br/><br/><br/><br/>
                                                </div>
                                            </div>
                                            <div class="tab-pane" id="tabsleft-tab2">
                                                <h3>Thông tin đăng nhập</h3>
                                                <div class="control-group">
                                                    <label class="control-label">Mã nhân viên</label>
                                                    <div class="controls">
                                                        <input name="txtMaNV" class="span6 " type="text" readonly="true" placeholder="" value="<%=nv.getManv()%>">
                                                        <span class="help-inline"></span>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Mật khẩu(*)</label>
                                                    <div class="controls">
                                                        <input name="txtMatKhau" class="span6 " id="cname" minlength="2" type="password" required readonly value="<%=nv.getMatkhau()%>"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="tab-pane" id="tabsleft-tab3">
                                                <h3>Cập nhật thông tin cá nhân</h3>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Họ tên (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtHoTen" minlength="2" type="text" required value="<%=nv.getHoten()%>"/>
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label class="control-label">Giới tính</label>
                                                    <div class="controls">
                                                        <div id="text-toggle-button">
                                                            <%
                                                                if (nv.getGioitinh() != null)
                                                                {
                                                            %>
                                                            <input checked="true" name="chbGioiTinh" type="checkbox">
                                                            <%}
                                                            else
                                                            {
                                                            %>
                                                            <input name="chbGioiTinh" type="checkbox">
                                                            <%}%>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Địa chỉ (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtDiaChi" minlength="2" type="text" required value="<%=nv.getDiachi()%>"/>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Số điện thoại (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtDienThoai" minlength="2" type="text" required value="<%=nv.getSodienthoai()%>"/>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label class="control-label" for="cemail">E-Mail (*)</label>
                                                    <div class="controls">
                                                        <input id="cemail" class="span6 " type="email" required="" name="txtEmail" value="<%=nv.getEmail()%>"/>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">CMND (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtCMND" minlength="2" type="text" required value="<%=nv.getCmnd()%>"/>
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <label class="control-label">Ngày sinh (*)</label>
                                                    <div class="controls">
                                                        <div class="input-append date" id="dpYears" data-date="11/11/1991"
                                                             data-date-format="dd/mm/yyyy" data-date-viewmode="years">
                                                            <input name="txtNgaySinh" class="m-ctrl-medium" size="16" type="text" value="<%=CXuLy.ConvertDateToString(nv.getNgaysinh())%>" readonly >
                                                            <span class="add-on"><i class="icon-calendar"></i></span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label class="control-label">Ghi chú</label>
                                                    <div class="controls">
                                                        <textarea name="txtGhiChu" class="span6 " rows="3"><%=nv.getGhichu()%></textarea>
                                                    </div>
                                                </div>
                                            </div>

                                            <ul class="pager wizard">
                                                <li class="previous first"><a href="javascript:;">First</a></li>
                                                <li class="previous"><a href="javascript:;">Previous</a></li>
                                                <li class="next last"><a href="javascript:;">Last</a></li>
                                                <li class="next"><a href="javascript:;">Next</a></li>
                                                <li class="next finish" style="display:none;"><button name="btnCapNhatNhanVien" class="btn btn-large btn-primary" type="submit">Cập nhật nhân viên</button></li>
                                            </ul>
                                        </div>
                                    </div>
                                </form>
                                <%}
                                else
                                {%>
                                <form method="post" class="form-horizontal" action="them-nhan-vien.htm">
                                    <div id="tabsleft" class="tabbable tabs-left">
                                        <ul>
                                            <li><a href="#tabsleft-tab1" data-toggle="tab"><span class="strong">Bước 1</span> <span class="muted">Chức vụ</span></a></li>
                                            <li><a href="#tabsleft-tab2" data-toggle="tab"><span class="strong">Bước 2</span> <span class="muted">Thông tin đăng nhập</span></a></a></li>
                                            <li><a href="#tabsleft-tab3" data-toggle="tab"><span class="strong">Bước 3</span> <span class="muted">Thông tin cá nhân</span></a></a></li>
                                        </ul>
                                        <div class="progress progress-info progress-striped">
                                            <div class="bar"></div>
                                        </div>
                                        <div class="tab-content">
                                            <div class="tab-pane" id="tabsleft-tab1">
                                                <h3>Chọn chức vụ</h3>
                                                <div class="control-group">
                                                    <label class="control-label">Chức vụ</label>
                                                    <div class="controls">
                                                        <select name="ddlLoaiNV" class="span6 chzn-select" data-placeholder="Chọn ..." tabindex="1" required>
                                                            <%
                                                                for (Loainhanvien loaiNV : dsLoaiNV)
                                                                {
                                                            %>
                                                            <option value="<%=loaiNV.getId()%>"><%=loaiNV.getTenloai()%></option>
                                                            <%}%>
                                                        </select>
                                                    </div>
                                                    <br/><br/><br/><br/><br/>
                                                </div>
                                            </div>
                                            <div class="tab-pane" id="tabsleft-tab2">
                                                <h3>Điền thông tin đăng nhập</h3>
                                                <div class="control-group">
                                                    <label class="control-label">Mã nhân viên</label>
                                                    <%
                                                        int slNhanVien = Integer.parseInt(request.
                                                                getAttribute("slNhanVien").
                                                                toString());
                                                        String MaNV = "NV0" + (slNhanVien + 1);
                                                    %>
                                                    <div class="controls">
                                                        <input name="txtMaNV" class="span6 " type="text" readonly="true" placeholder="" value="<%=MaNV%>">
                                                        <span class="help-inline"></span>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Mật khẩu (*)</label>
                                                    <div class="controls">
                                                        <input name="txtMatKhau" class="span6 " id="cname" minlength="2" type="password" required />
                                                    </div>
                                                    <br/><br/><br/>
                                                </div>
                                            </div>
                                            <div class="tab-pane" id="tabsleft-tab3">
                                                <h3>Điền thông tin cá nhân</h3>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Họ tên (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtHoTen" minlength="2" type="text" required />
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label class="control-label">Giới tính</label>
                                                    <div class="controls">
                                                        <div id="text-toggle-button">
                                                            <input name="chbGioiTinh" type="checkbox">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Địa chỉ (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtDiaChi" minlength="2" type="text" required />
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">Số điện thoại (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtDienThoai" minlength="2" type="text" required />
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label class="control-label" for="cemail">E-Mail (*)</label>
                                                    <div class="controls">
                                                        <input id="cemail" class="span6 " type="email" required="" name="txtEmail">
                                                    </div>
                                                </div>
                                                <div class="control-group ">
                                                    <label for="cemail" class="control-label">CMND (*)</label>
                                                    <div class="controls">
                                                        <input class="span6 " id="cname" name="txtCMND" minlength="2" type="text" required />
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <label class="control-label">Ngày sinh (*)</label>
                                                    <div class="controls">
                                                        <div class="input-append date" id="dpYears" data-date="11/11/1991"
                                                             data-date-format="dd/mm/yyyy" data-date-viewmode="years">
                                                            <input name="txtNgaySinh" class="m-ctrl-medium" size="16" type="text" value="11/11/1991" readonly >
                                                            <span class="add-on"><i class="icon-calendar"></i></span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label class="control-label">Ghi chú</label>
                                                    <div class="controls">
                                                        <textarea name="txtGhiChu" class="span6 " rows="3"></textarea>
                                                    </div>
                                                </div>
                                            </div>

                                            <ul class="pager wizard">
                                                <li class="previous first"><a href="javascript:;">First</a></li>
                                                <li class="previous"><a href="javascript:;">Previous</a></li>
                                                <li class="next last"><a href="javascript:;">Last</a></li>
                                                <li class="next"><a href="javascript:;">Next</a></li>
                                                <li class="next finish" style="display:none;"><button name="btnThemNhanVien" class="btn btn-large btn-primary" type="submit">Thêm nhân viên</button></li>
                                            </ul>
                                        </div>
                                    </div>
                                </form>
                                <%
                                    }
                                    String message = (String) request.getAttribute("Message");
                                    if (message != null)
                                    {
                                        out.println(
                                                "<p align='center'><font style='size: 40px' color='red'>" + message + "</font></p>");
                                    }
                                    }
                                    else
                                    {
                                        %>
                                         <h1 style="color: red">The page you requested was not found.
                                                                                </h1>
                                        <%
                                    }
                                %>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-------------------------------- ket thuc nội dung--------------------------------------->

    </div>

    <!--------------------------------footer--------------------------------------->
    <jsp:include page="User Control/footer.jsp" flush="true"></jsp:include>
    <!--------------------------------end footer--------------------------------------->

    <!-- Load javascripts at bottom, this will reduce page load time -->
    <script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="assets/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script>
    <script src="js/jquery.blockui.js"></script>
    <!-- ie8 fixes -->
    <!--[if lt IE 9]>
    <script src="js/excanvas.js"></script>
    <script src="js/respond.js"></script>
    <![endif]-->
    <!--    New script-->
    <script type="text/javascript" src="assets/bootstrap-toggle-buttons/static/js/jquery.toggle.buttons.js"></script>
    <script type="text/javascript" src="assets/chosen-bootstrap/chosen/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="assets/uniform/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="assets/clockface/js/clockface.js"></script>
    <script type="text/javascript" src="assets/jquery-tags-input/jquery.tagsinput.min.js"></script>
    <script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-daterangepicker/date.js"></script>
    <script type="text/javascript" src="assets/bootstrap-daterangepicker/daterangepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>
    <script src="assets/fancybox/source/jquery.fancybox.pack.js"></script>


    <!--common script for all pages-->
    <script src="js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="js/form-wizard.js"></script>
    <script src="js/form-component.js"></script>



    <!--script for this page-->
    <!-- END JAVASCRIPTS -->

</body>
</html>